package com.fizzkai.p2p.website.controller;

import com.fizzkai.p2p.bussness.domain.PlatformBankInfo;
import com.fizzkai.p2p.bussness.domain.RechargeOffline;
import com.fizzkai.p2p.bussness.service.IPlatformBankInfoService;
import com.fizzkai.p2p.bussness.service.IRechargeOfflineService;
import com.fizzkai.p2p.core.query.QueryObject;
import com.fizzkai.p2p.core.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class ReChargeOfflineController {
    public static final QueryObject QO = new QueryObject();
    @Autowired
    private IPlatformBankInfoService bankInfoService;
    @Autowired
    private IRechargeOfflineService rechargeOfflineService;

    @RequestMapping("/recharge")
    public String recharge(Model model){
        // banks 获取公司所有账户
        List<PlatformBankInfo> banks = bankInfoService.list();
        model.addAttribute("banks", banks);
        return "recharge";
    }

    /**
     * 发起 充值审核请求
     * @return
     */
    @RequestMapping("/recharge_save")
    @ResponseBody
    public Object recharge_save(RechargeOffline entity){
        rechargeOfflineService.apply(entity);
        return new AjaxResult("申请成功");
    }

}
